package cn.edu.scau.cmi.zhangjunjia.singleton;

import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.control.TextArea;


public class SingletonController implements Initializable{
	
	@FXML
	private Button button1;
	
	@FXML
	private TextField text1;
	
	@FXML
	private TextArea area1;
	
	@FXML
	private Button button2;
	
	@FXML
	private TextField text2;
	
	@FXML
	private TextArea area2;
	
	public void buttonOne() {
		Chairman chairman = Chairman.getInstance(text1.getText());
		String text =chairman.getName()+chairman.toString();
		area1.setText(area1.getText()+text+"Create!\n" );
		System.out.println(text+"Create!\n");
	}
	
	public void buttonTwo() {
		String judgeName = Marshal.judgeName(text2.getText());
		if(judgeName == "1") {
			Marshal marshal = Marshal.getInstance(text2.getText());
			area2.setText(area2.getText()+text2.getText()+marshal.toString()+"Create!\n");
		}
		else {
			area2.setText(area2.getText()+ judgeName);
		}
		
	}
	
	
	
	
	@Override
	public void initialize (URL location, ResourceBundle resources) {
		
	}

}
